/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VendorFrame.java
 *
 * Created on Mar 9, 2011, 10:21:48 AM
 */

package gbbmgmt;

import org.jdesktop.application.Action;
import java.util.*;
import javax.swing.JOptionPane;

/**
 *
 * @author dchapman
 */
public class VendorFrame extends javax.swing.JFrame {

    public ArrayList<String[]> Vendors;

    /** Creates new form VendorFrame */
    public VendorFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jComboBoxVendor = new javax.swing.JComboBox();
        jButtonCustFirst = new javax.swing.JButton();
        jButtonCustPrev = new javax.swing.JButton();
        jButtonCustNext = new javax.swing.JButton();
        jButtonCustLast = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel1 = new javax.swing.JLabel();
        jLabelVendorID = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTextFieldVName = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextFieldVAddr = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTextFieldVCity = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTextFieldVState = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jTextFieldVZip = new javax.swing.JTextField();
        jButtonUpdate = new javax.swing.JButton();
        jButtonNew = new javax.swing.JButton();
        jButtonSubmit = new javax.swing.JButton();
        jButtonExit = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jTextFieldVNotes = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTextFieldVPhone = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jTextFieldVEmail = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N

        jComboBoxVendor.setName("jComboBoxVendor"); // NOI18N
        jComboBoxVendor.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
            public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
            }
            public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
                jComboBoxVendorPopupMenuWillBecomeInvisible(evt);
            }
            public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
            }
        });

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(gbbmgmt.GBBMGMTApp.class).getContext().getActionMap(VendorFrame.class, this);
        jButtonCustFirst.setAction(actionMap.get("FirstRecord")); // NOI18N
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(gbbmgmt.GBBMGMTApp.class).getContext().getResourceMap(VendorFrame.class);
        jButtonCustFirst.setText(resourceMap.getString("jButtonCustFirst.text")); // NOI18N
        jButtonCustFirst.setName("jButtonCustFirst"); // NOI18N

        jButtonCustPrev.setAction(actionMap.get("PrevRecord")); // NOI18N
        jButtonCustPrev.setText(resourceMap.getString("jButtonCustPrev.text")); // NOI18N
        jButtonCustPrev.setName("jButtonCustPrev"); // NOI18N

        jButtonCustNext.setAction(actionMap.get("NextRecord")); // NOI18N
        jButtonCustNext.setText(resourceMap.getString("jButtonCustNext.text")); // NOI18N
        jButtonCustNext.setName("jButtonCustNext"); // NOI18N

        jButtonCustLast.setAction(actionMap.get("LastRecord")); // NOI18N
        jButtonCustLast.setText(resourceMap.getString("jButtonCustLast.text")); // NOI18N
        jButtonCustLast.setName("jButtonCustLast"); // NOI18N

        jSeparator1.setName("jSeparator1"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabelVendorID.setText(resourceMap.getString("jLabelVendorID.text")); // NOI18N
        jLabelVendorID.setName("jLabelVendorID"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jTextFieldVName.setText(resourceMap.getString("jTextFieldVName.text")); // NOI18N
        jTextFieldVName.setName("jTextFieldVName"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jTextFieldVAddr.setText(resourceMap.getString("jTextFieldVAddr.text")); // NOI18N
        jTextFieldVAddr.setName("jTextFieldVAddr"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jTextFieldVCity.setText(resourceMap.getString("jTextFieldVCity.text")); // NOI18N
        jTextFieldVCity.setName("jTextFieldVCity"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jTextFieldVState.setText(resourceMap.getString("jTextFieldVState.text")); // NOI18N
        jTextFieldVState.setName("jTextFieldVState"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jTextFieldVZip.setText(resourceMap.getString("jTextFieldVZip.text")); // NOI18N
        jTextFieldVZip.setName("jTextFieldVZip"); // NOI18N

        jButtonUpdate.setAction(actionMap.get("UpdateVendor")); // NOI18N
        jButtonUpdate.setText(resourceMap.getString("jButtonUpdate.text")); // NOI18N
        jButtonUpdate.setName("jButtonUpdate"); // NOI18N

        jButtonNew.setAction(actionMap.get("NewVendor")); // NOI18N
        jButtonNew.setText(resourceMap.getString("jButtonNew.text")); // NOI18N
        jButtonNew.setName("jButtonNew"); // NOI18N

        jButtonSubmit.setAction(actionMap.get("SubmitVendor")); // NOI18N
        jButtonSubmit.setText(resourceMap.getString("jButtonSubmit.text")); // NOI18N
        jButtonSubmit.setName("jButtonSubmit"); // NOI18N

        jButtonExit.setAction(actionMap.get("VExit")); // NOI18N
        jButtonExit.setText(resourceMap.getString("jButtonExit.text")); // NOI18N
        jButtonExit.setName("jButtonExit"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jTextFieldVNotes.setText(resourceMap.getString("jTextFieldVNotes.text")); // NOI18N
        jTextFieldVNotes.setName("jTextFieldVNotes"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jTextFieldVPhone.setText(resourceMap.getString("jTextFieldVPhone.text")); // NOI18N
        jTextFieldVPhone.setName("jTextFieldVPhone"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jTextFieldVEmail.setText(resourceMap.getString("jTextFieldVEmail.text")); // NOI18N
        jTextFieldVEmail.setName("jTextFieldVEmail"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jComboBoxVendor, 0, 295, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jButtonCustFirst)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonCustPrev)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonCustNext)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonCustLast)
                .addContainerGap())
            .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelVendorID)
                .addContainerGap(451, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel9)
                    .addComponent(jLabel8)
                    .addComponent(jLabel4)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextFieldVName, javax.swing.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE)
                    .addComponent(jTextFieldVAddr, javax.swing.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jTextFieldVPhone, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
                            .addComponent(jTextFieldVCity, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldVState, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldVZip, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jTextFieldVEmail, javax.swing.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldVNotes, javax.swing.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButtonUpdate)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonNew)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonSubmit)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 189, Short.MAX_VALUE)
                .addComponent(jButtonExit)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jButtonCustPrev)
                    .addComponent(jButtonCustNext)
                    .addComponent(jButtonCustFirst)
                    .addComponent(jButtonCustLast)
                    .addComponent(jComboBoxVendor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabelVendorID))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldVName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jTextFieldVAddr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldVCity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldVZip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(jTextFieldVState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jTextFieldVPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jTextFieldVEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jTextFieldVNotes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(38, 38, 38)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonExit)
                    .addComponent(jButtonUpdate)
                    .addComponent(jButtonNew)
                    .addComponent(jButtonSubmit))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jComboBoxVendorPopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBoxVendorPopupMenuWillBecomeInvisible
        // TODO add your handling code here:
        String Itm = jComboBoxVendor.getSelectedItem().toString();

        for(String s[] : Vendors){
            if (s[1].equals(Itm)) {
                DBA.openDBCon();
                DBA.GetVendorData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
    }//GEN-LAST:event_jComboBoxVendorPopupMenuWillBecomeInvisible

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VendorFrame().setVisible(true);
            }
        });
    }

    public void LoadList(){

        //Remove all vendors in list.
        jComboBoxVendor.removeAllItems();

        DBA.openDBCon();
        Vendors = DBA.RunSQLQuery("SELECT VID,VName FROM Vendors");
        DBA.closeDBCon();

        for(String s[] : Vendors){
            jComboBoxVendor.addItem(s[1]);
        }

        //Hide submit button.
        jButtonSubmit.setVisible(false);
        
        LastRecord();
    }

    @Action
    public void VExit() {
        dispose();
    }

    @Action
    public void NewVendor() {
        //Show Submit button.
        jButtonSubmit.setVisible(true);

        //Hide all appropriate buttons.
        jButtonUpdate.setVisible(false);
        jButtonNew.setVisible(false);
        jButtonCustFirst.setVisible(false);
        jButtonCustLast.setVisible(false);
        jButtonCustNext.setVisible(false);
        jButtonCustPrev.setVisible(false);
        jComboBoxVendor.setVisible(false);
        jLabelVendorID.setVisible(false);
        jLabel1.setVisible(false);

        //Set text in all fields to blank.
        jTextFieldVAddr.setText("");
        jTextFieldVCity.setText("");
        jTextFieldVEmail.setText("");
        jTextFieldVName.setText("");
        jTextFieldVNotes.setText("");
        jTextFieldVPhone.setText("");
        jTextFieldVState.setText("");
        jTextFieldVZip.setText("");

    }

    @Action
    public void SubmitVendor() {
        int response = JOptionPane.showConfirmDialog(null,
                "Warning, this record will be added to the database, continue?",
                "Warning",JOptionPane.WARNING_MESSAGE);
        if (response == 0){
            String fields = "VName,VAddr,VCity,VState,VZip,VPhone,VEmail,VNotes";
            String query = "'" +
                jTextFieldVName.getText() + "','" +
                jTextFieldVAddr.getText() + "','" +
                jTextFieldVCity.getText() + "','" +
                jTextFieldVState.getText() + "','" +
                jTextFieldVZip.getText() + "','" +
                jTextFieldVPhone.getText() + "','" +
                jTextFieldVEmail.getText() + "','" +
                jTextFieldVNotes.getText() + "'";
            DBA.openDBCon();
            DBA.RunSQLInsertQuery("Vendors",fields,query);
            DBA.closeDBCon();
        }

        //hide Submit button.
        jButtonSubmit.setVisible(false);

        //show all appropriate buttons.
        jButtonUpdate.setVisible(true);
        jButtonNew.setVisible(true);
        jButtonCustFirst.setVisible(true);
        jButtonCustLast.setVisible(true);
        jButtonCustNext.setVisible(true);
        jButtonCustPrev.setVisible(true);
        jComboBoxVendor.setVisible(true);
        jLabelVendorID.setVisible(true);
        jLabel1.setVisible(true);

        LoadList();
    }

    @Action
    public void FirstRecord() {
        jComboBoxVendor.setSelectedIndex(0);

        String Itm = jComboBoxVendor.getSelectedItem().toString();

        for(String s[] : Vendors){
            if (s[1].equals(Itm)) {
                DBA.openDBCon();
                DBA.GetVendorData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
    }

    public void SetData(){
        jLabelVendorID.setText(Integer.toString(DBA.VID));
        jTextFieldVName.setText(DBA.VName);
        jTextFieldVAddr.setText(DBA.VAddr);
        jTextFieldVCity.setText(DBA.VCity);
        jTextFieldVEmail.setText(DBA.VEmail);
        jTextFieldVNotes.setText(DBA.VNotes);
        jTextFieldVPhone.setText(DBA.VPhone);
        jTextFieldVState.setText(DBA.VState);
        jTextFieldVZip.setText(DBA.VZip);
    }

    @Action
    public void LastRecord() {
        jComboBoxVendor.setSelectedIndex(jComboBoxVendor.getItemCount()-1);

        String Itm = jComboBoxVendor.getSelectedItem().toString();

        for(String s[] : Vendors){
            if (s[1].equals(Itm)) {
                DBA.openDBCon();
                DBA.GetVendorData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
    }

    @Action
    public void PrevRecord() {
        if(jComboBoxVendor.getSelectedIndex()>=1){
            jComboBoxVendor.setSelectedIndex(jComboBoxVendor.getSelectedIndex()-1);
        }

        String Itm = jComboBoxVendor.getSelectedItem().toString();

        for(String s[] : Vendors){
            if (s[1].equals(Itm)) {
                DBA.openDBCon();
                DBA.GetVendorData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
    }

    @Action
    public void NextRecord() {
        if(jComboBoxVendor.getSelectedIndex() <= (jComboBoxVendor.getItemCount()-2)){
            jComboBoxVendor.setSelectedIndex(jComboBoxVendor.getSelectedIndex()+1);
        }

        String Itm = jComboBoxVendor.getSelectedItem().toString();

        for(String s[] : Vendors){
            if (s[1].equals(Itm)) {
                DBA.openDBCon();
                DBA.GetVendorData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
    }

    @Action
    public void UpdateVendor() {
        int response = JOptionPane.showConfirmDialog(null,
                "This will modify vendor data, continue?",
                "Warning",JOptionPane.WARNING_MESSAGE);

        if (response == 0){
            DBA.openDBCon();

            String VendorID = jLabelVendorID.getText();

            String query = "UPDATE Vendors SET VName='" +
                        jTextFieldVName.getText() + "',VAddr='" +
                        jTextFieldVAddr.getText() + "',VCity='" +
                        jTextFieldVCity.getText() + "',VState='" +
                        jTextFieldVState.getText() + "',VZip='" +
                        jTextFieldVZip.getText() + "',VPhone='" +
                        jTextFieldVPhone.getText() + "',VEmail='" +
                        jTextFieldVEmail.getText() + "',VNotes='" +
                        jTextFieldVNotes.getText() +
                        "'WHERE VID = '" + VendorID + "'";
            DBA.RunSQLUpdateQuery(query);

            DBA.closeDBCon();
        }

    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonCustFirst;
    private javax.swing.JButton jButtonCustLast;
    private javax.swing.JButton jButtonCustNext;
    private javax.swing.JButton jButtonCustPrev;
    private javax.swing.JButton jButtonExit;
    private javax.swing.JButton jButtonNew;
    private javax.swing.JButton jButtonSubmit;
    private javax.swing.JButton jButtonUpdate;
    private javax.swing.JComboBox jComboBoxVendor;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelVendorID;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField jTextFieldVAddr;
    private javax.swing.JTextField jTextFieldVCity;
    private javax.swing.JTextField jTextFieldVEmail;
    private javax.swing.JTextField jTextFieldVName;
    private javax.swing.JTextField jTextFieldVNotes;
    private javax.swing.JTextField jTextFieldVPhone;
    private javax.swing.JTextField jTextFieldVState;
    private javax.swing.JTextField jTextFieldVZip;
    // End of variables declaration//GEN-END:variables

}
